home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / ANSI Headers / unistd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  2.6 KB  |  130 lines  |  [TEXT/MMCC]

  1. /*
  2.  *    File:        unistd.h
  3.  *                ©1993-1995 metrowerks Inc. All rights reserved
  4.  *    Author:        Berardino E. Baratta
  5.  *
  6.  *    Content:    Interface file to standard UNIX-style entry points ...
  7.  *
  8.  *    NB:            This file implements some UNIX low level support.  These functions
  9.  *                are not guaranteed to be 100% conformant.
  10.  */
  11.  
  12. #ifndef    _UNISTD
  13. #define    _UNISTD
  14.  
  15. #pragma options align=mac68k
  16.  
  17. #ifndef _STDIO
  18.     /* macros for whence parameter of lseek() (taken from <stdio.h> */
  19.     #define SEEK_SET    0
  20.     #define SEEK_CUR    1
  21.     #define SEEK_END    2
  22. #endif
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28. /*
  29.  *    Change the current directory.
  30.  */
  31. int chdir(const char *path);
  32.  
  33. /*
  34.  *    Closes an open file.
  35.  */
  36. int close(int fildes);
  37.  
  38. /*
  39.  *    Returns the user name associated with the current process.  For the mac we always return
  40.  *    the login name.  If string is not NULL, it must be at least FILENAME_MAX large.
  41.  */
  42. char *cuserid(char *string);
  43.  
  44. /*
  45.  *    Launches the application fname and then quits upon succesful launch.
  46.  *    NB: all exec calls pass through this one call, since argument passing (argc, argv) doesn't
  47.  *        exist for mac applications.
  48.  */
  49. int exec(const char *path, ...);
  50. #define execl            exec
  51. #define execv            exec
  52. #define execle            exec
  53. #define execle            exec
  54. #define execve            exec
  55. #define execlp            exec
  56. #define execvp            exec
  57.  
  58. /*
  59.  *    Get the current directory.
  60.  */
  61. char *getcwd(char *buf, int size);
  62.  
  63. /*
  64.  *    The following UNIX functions don't really have any meaning on the Mac, so we just
  65.  *    return values that would make sense for a typical user process under UNIX ...
  66.  */
  67.  
  68. #define getpid()        ((int) 9000)
  69. #define getppid()        ((int) 8000)
  70. #define getuid()        ((int) 200)
  71. #define geteuid()        ((int) 200)
  72. #define getgid()        ((int) 100)
  73. #define getegid()        ((int) 100)
  74. #define getpgrp()        ((int) 9000)
  75.  
  76. /*
  77.  *    The Mac doesn't have a login, so we just return the Owner Name from the Sharing Setup
  78.  *    Control Panel.
  79.  */
  80. char *getlogin(void);
  81.  
  82. /*
  83.  *    Determines is a specified fileid is attached to the console.
  84.  */
  85. int isatty(int fildes);
  86.  
  87. /*
  88.  *    Seek on a file stream.
  89.  */
  90. long lseek(int fildes, long offset, int whence);
  91.  
  92. /*
  93.  *    Reads from a file stream.
  94.  */
  95. int read(int fildes, char *buf, int count);
  96.  
  97. /*
  98.  *    Delete a directory.
  99.  */
  100. int rmdir(const char *path);
  101.  
  102. /*
  103.  *    Delay program execution for a specified number of seconds.
  104.  */
  105. unsigned int sleep(unsigned int sleep);
  106.  
  107. /*
  108.  *    Returns the name of the terminal associated with the fileid, or NULL if fileid doesn't
  109.  *    specify a terminal.
  110.  */
  111. char *ttyname(int fildes);
  112.  
  113. /*
  114.  *    Unlink (delete) a file.
  115.  */
  116. int unlink(const char *path);
  117.  
  118. /*
  119.  *    Writes to a file stream.
  120.  */
  121. int write(int fildes, const char *buf, int count);
  122.  
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126.  
  127. #pragma options align=reset
  128.  
  129. #endif
  130.